{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import zmq\n",
    "import time\n",
    "import random"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "class FloatTensor():\n",
    "    \n",
    "    def __init__(self, data, controller):\n",
    "        \n",
    "        self.controller = controller\n",
    "        \n",
    "        message = '0'\n",
    "        \n",
    "        for x in data:\n",
    "            message += \" \" + str(x)\n",
    "        print(message)\n",
    "            \n",
    "        self.controller.socket.send_string(message)\n",
    "        response = sc.socket.recv_string()\n",
    "        print(\"Response:\" + str(response))\n",
    "\n",
    "class SyftController():\n",
    "    \n",
    "    def __init__(self):\n",
    "        context = zmq.Context()\n",
    "        self.socket = context.socket(zmq.REQ)\n",
    "        self.socket.connect(\"tcp://localhost:5555\")\n",
    "    \n",
    "    def FloatTensor(self,data):\n",
    "        return FloatTensor(data,self)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "sc = SyftController()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 1 2 3 4\n",
      "Response:World\n"
     ]
    }
   ],
   "source": [
    "t = sc.FloatTensor(np.array([1,2,3,4]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
